module.exports = (req, res) => {
  require('../util/service').handlePost(req, res, (reqObj, resolve) => {
	const mongoMng = require('../mng/mongoMng')
    if (!mongoMng.db) {
      log('mongo未连接')
      resolve({
        result: -1,
        msg: '系统错误'
      })
      return
    }
    if (!reqObj.openid) {
      resolve({
        result: -1,
        msg: '缺少openid'
      })
      return
    }
    if (!reqObj.note) {
      resolve({
        result: -1,
        msg: '缺少note'
      })
      return
    }
    mongoMng.db.collection('note').insert({
      openid: reqObj.openid,
      note: reqObj.note
    }, (err, result) => {
      if (err) {
        log(err);
        resolve({
          result: -1,
          msg: '系统错误'
        })
        return;
      }
      resolve({
        result: 1,
        msg: '成功'
      })
    });
  })
}
